site_title=Staticflora

escape() {
	local sedscript='s/&/\&amp;/g;
		s/</\&lt;/g;
		s/>/\&gt;/g;
		s/"/\&quot;/g;
		s/'"'"'/\&#39;/g'

	if [ -z "$1" ]; then
		cat | sed "$sedscript"
	else
		echo "$1" | sed "$sedscript"
	fi
}

offset_headings() {
	cat | sed 's/<h3/<h'$((3+$1))'/g;
		s/<h2/<h'$((2+$1))'/g;
		s/<h1/<h'$((1+$1))'/g;
		s/<\/h3>/<\/h'$((3+$1))'/g;
		s/<\/h2>/<\/h'$((2+$1))'>/g;
		s/<\/h1>/<\/h'$((1+$1))'>/g'
}

url() {
	echo "$BASE_URL$(escape "$1")"
}

alias md='markdown -f +idanchor,+toc -b "$BASE_URL"'
